using System;
namespace 数组
{
    class Program
    {
        private static int GetMax(int[] array)
       {
          int max = array[0];
          for (int i = 0; i<array.Length; i++)
           {
              max = max > array[i]? max : array[i];

           }
           return max;
      }
        private static int GetMin(int[] array)
        {
            int min = array[0];
            for (int i = 0; i < array.Length; i++)
            {
                min = min < array[i] ? min : array[i];

            }
            return min;
        }
        private static int GetSum(int[] array)
        {
            int sum = 0;
            for (int i = 0; i < array.Length; i++)
            {
                sum += array[i];
            }
            return sum;
        }
        static void Main()
        {
            int[] array = { 1,4,2,8,5,7,9,3,0 };
            int max = GetMax(array);
            int min = GetMin(array);
            int sum = GetSum(array);
            double  average = sum / array.Length;
            Console.WriteLine("数组中最大的值是{0}", max);
            Console.WriteLine("数组中最小的值是{0}", min);
            Console.WriteLine("数组中元素之和为{0}", sum);
            Console.WriteLine("数组中的平均数为{0}", average);        
        }               
    }
}